/*
 * File:    Defines_CircularBuffer.h
 * Project:	HobbyPilotFirmware (HPF)
 * Author:  Wouter van Verre
 *
 * Created on February 12, 2011, 1:39 PM
 */

#ifndef __DEFINES_CIRCULARBUFFER_H
#define __DEFINES_CIRCULARBUFFER_H

/** Defines **/

/** Typedefines **/

/** Structures **/
typedef struct
{
	int size;
    int numOfPlacesTaken;

    uint8 *startPointer;
    uint8 *endPointer;
    uint8 *readPointer;
    uint8 *writePointer;
} CircularBuffer;

/** Function Definitions **/
extern void initCircularBuffer(CircularBuffer *buffer, int size);
extern int8 writeToCircularBuffer(CircularBuffer *buffer, uint8 *data, int numOfBytes);
extern int8 writeByteToCircularBuffer(CircularBuffer *buffer, uint8 data);
extern int8 readByteFromCircularBuffer(CircularBuffer *buffer, uint8 *data);

/** Variable Definitions **/
extern CircularBuffer UART1TXBuffer;
extern CircularBuffer UART1RXBuffer;

#endif
